home *** CD-ROM | disk | FTP | other *** search
/ CD Ware Multimedia 1995 May / cd Ware (Juegos) Epimundo.iso / DOS / PRGMMING / CNVLIBD.ZIP / MOUSEWIN.BAT < prev    next >
Encoding:
DOS Batch File  |  1994-05-11  |  1.2 KB  |  41 lines

  1. @echo OFF
  2. REM ***********************************************************
  3. REM *** MouseWin.bat - Run windows if mouse key is pressed  ***
  4. REM *** ver.1          else timeout and do not run windows. ***
  5. REM ***                This will run some CEnvi code that   ***
  6. REM ***                will keep checking for the mouse     ***
  7. REM ***                being pressed and will exit with     ***
  8. REM ***                ERRORLEVEL 1 if the mouse was        ***
  9. REM ***                pressed, or ERRORLEVEL 0 if timeout. ***
  10. REM ***                If ERRORLEVEL 1 run Windows.         ***
  11. REM ***********************************************************
  12.  
  13. CEnvi %0.bat
  14. GOTO CENVI_EXIT
  15.  
  16.    #define TIMEOUT 30   // how many seconds before timeout
  17.  
  18.    // Print instructions
  19.    puts("Press mouse button to run Windows...");
  20.  
  21.    // Initialize the mouse
  22.    reg.ax = 0;
  23.    interrupt(0x33,reg);
  24.  
  25.    // until timeout, wait for mouse input
  26.    StartTime = time();
  27.    while ( difftime(time(),StartTime) < TIMEOUT ) {
  28.       undefine(reg);
  29.       reg.ax = 3;
  30.       interrupt(0x33,reg);
  31.       if ( reg.bx )
  32.          exit(1);
  33.    }
  34.  
  35.    // if made here then timeout
  36.    exit(0);
  37.  
  38. :CENVI_EXIT
  39.  
  40. IF ERRORLEVEL 1 WIN
  41.